''' <summary>
''' Store list of stations and currently playing station.
''' </summary>
''' <remarks></remarks>
<Serializable()> _
Public Class StationList

    Private _stations As List(Of OnlineStation)
    Private _curIdx As Integer

    ''' <summary>
    ''' Creates an empty stations list.
    ''' </summary>
    Public Sub New()
        _stations = New List(Of OnlineStation)
        _curIdx = 0
    End Sub

    ''' <summary>
    ''' Switch to the next station on the list.
    ''' </summary>
    ''' <remarks>If current station is the last station on the list,
    ''' this will switch to the first station instead.</remarks>
    Public Sub NextStation()
        _curIdx = (_curIdx + 1) Mod _stations.Count
    End Sub

    ''' <summary>
    ''' Switch to previous station on the list.
    ''' </summary>
    ''' <remarks>If current station is the first station on the list,
    ''' this will switch to the last station instead.</remarks>
    Public Sub PrevStation()
        _curIdx = (_curIdx + _stations.Count - 1) Mod _stations.Count
    End Sub

    ''' <summary>
    ''' Gets current station.
    ''' </summary>
    ''' <value>Current station</value>
    ''' <returns>Current station as an OnlineStation object.</returns>
    ''' <remarks></remarks>
    Public ReadOnly Property CurrentStation() As OnlineStation
        Get
            Return _stations(_curIdx)
        End Get
    End Property

    ''' <summary>
    ''' Gets or sets current station index.
    ''' </summary>
    ''' <value>New station index.</value>
    ''' <returns>Current station index.</returns>
    ''' <remarks></remarks>
    Public Property CurrentStationIndex() As Integer
        Get
            Return _curIdx
        End Get
        Set(ByVal value As Integer)
            _curIdx = value
        End Set
    End Property

    ''' <summary>
    ''' Gets list of stations.
    ''' </summary>
    ''' <value>List of stations.</value>
    ''' <returns>List of stations.</returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Stations() As List(Of OnlineStation)
        Get
            Return _stations
        End Get
    End Property

    ''' <summary>
    ''' Gets station with the specified index.
    ''' </summary>
    ''' <param name="index">Index of the station you want.</param>
    ''' <value></value>
    ''' <returns>Station with specified index as an OnlineStation instance.</returns>
    ''' <remarks></remarks>
    Default Public ReadOnly Property Item(ByVal index As Integer) As OnlineStation
        Get
            Return _stations(index)
        End Get
    End Property

End Class
